package com.windowes.weichang.dao;

import com.baomidou.mybatisplus.plugins.Page;
import com.windowes.weichang.pojo.Demand;
import org.apache.ibatis.annotations.Param;

import java.math.BigDecimal;
import java.util.List;

public interface DemandMapper {
    int deleteByPrimaryKey(Integer id);

    int insert(Demand record);

    int insertSelective(Demand record);

    Demand selectByPrimaryKey(Integer id);

    int updateByPrimaryKeySelective(Demand record);

    int updateByPrimaryKey(Demand record);

    List<Demand> selectByPage(Page<Demand> page,
                              @Param("userId") Integer userId,
                              @Param("shopId") Integer shopId,
                              @Param("status") Short status,
                              @Param("keyword") String keyword,
                              @Param("type") String type);

    Integer getCount();

    Integer getUnHandleOrderCount();

    Integer getUnRebackOrderCount();

    List<Demand> selectByShopIds(List<Integer> list);

    List<Demand> selectAllByShopIds(List<Integer> list);

    List<Demand> selectDemadbyUserId(Integer userId);

    List<Demand> selectDemads(@Param("userId") Integer userId, @Param("shopId") Integer shopId);

    List<Demand> selectByShopId(Page<Demand> page,
                                @Param("shopId") Integer shopId, @Param("keyword") String keyword,
                                @Param("ids") List<Integer> ids);

    List<Integer> selectDistinctUserIds(@Param("shopId") Integer shopId);

    List<Demand> selectByStatus(Integer status);

    Demand selectByEbExternalId(String ebExternalId);

    BigDecimal sumByShopId(@Param("sId") Integer sId, @Param("status") Integer status);

    List<Demand> selectCalcByShopId(Integer sId, @Param("status") Integer status);


    int batchUpdateShopCalacStatus(@Param("calcStatus") int calcStatus, @Param("demandIds") List<Integer> demandIds);
}